var lineItemRepository = (function() {
    var getAll = function () {
        var lineItems = null;
        $.ajax({
            url: '../api/lineitem/get',
            type: 'GET',
            async: false,
            dataType: 'json',
            success: function (data) {
                lineItems = data;
                logger.info("Load line items: " + data.length);
            }
        });

        return lineItems;
    };
    
    var save = function (data) {
        $.ajax({
            type: 'POST',
            url: '../api/lineitem/Post',
            data: data,
            dataType: 'json',
            contentType: 'application/json',
            success: function () {
                logger.success("Line items is saved");
            }
        });
    };

    return {
        getAll: getAll,
        save: save
    };
})();